﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Wicresoft.SMS.Data;
using System.Configuration;


namespace Wicresoft.SMS.Web
{
    public class WebConfigProvider : IConnectStringProvider
    {
        private string _connectionString;

        public string ConnectionString
        {
            get
            {
                if (_connectionString == null)
                {
                    try
                    {
                        _connectionString = ConfigurationManager.ConnectionStrings["ApplicationSource"].ConnectionString;
                    }
                    catch (Exception ex)
                    { }
                }
                return _connectionString;
            }
        }

        private string _HRconnectionString;

        public string HRConnectionString
        {
            get
            {
                if (_HRconnectionString == null)
                {
                    try
                    {
                        _HRconnectionString = ConfigurationManager.ConnectionStrings["HResourceEntities"].ConnectionString;
                    }
                    catch (Exception ex)
                    {                        
                        throw;
                    }
                }
                return _HRconnectionString;
            }
        }
        private string _systemStartDate;

        public string SystemStartDate
        {
            get
            {
                if (_systemStartDate == null)
                {
                    try
                    {
                        _systemStartDate = ConfigurationManager.AppSettings["SystemStartDate"];
                    }
                    catch { }
                }
                return _systemStartDate;
            }
        }

        private string _price;

        public string Price
        {
            get
            {
                if (_price == null)
                {
                    try
                    {
                        _price = ConfigurationManager.AppSettings["Price"];
                    }
                    catch { }
                }
                return _price;
            }
        }

        private string _maxshowInHistory;

        public string MaxshowInHistory
        {
            get
            {
                if (_maxshowInHistory == null)
                {
                    try
                    {
                        _maxshowInHistory = ConfigurationManager.AppSettings["MaxshowInHistory"];
                    }
                    catch { }
                }
                return _maxshowInHistory;
            }
        }

        private string _CILServer;

        public string CILServer
        {
            get 
            {
                if (_CILServer == null)
                {
                    try
                    {
                        _CILServer = ConfigurationManager.AppSettings["CILServer"];
                    }
                    catch (Exception ex)
                    {
                        
                        throw;
                    }
                }
                return _CILServer; 
            }
        }

        private string _LocalHost;

        public string LocalHost
        {
            get
            {
                if (_LocalHost == null)
                {
                    try
                    {
                        _LocalHost = ConfigurationManager.AppSettings["LocalHost"];
                    }
                    catch (Exception ex)
                    {

                        throw;
                    }
                }
                return _LocalHost;
            }
        }
    }
}